package com.tedu.egweibo1.base.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private Integer state;
    private String message;
    private Object data;
    public JsonResult(StateCode stateCode ,Object data){
        this.message = stateCode.getMessage();
        this.state = stateCode.getState();
        this.data = data;
    }
    public JsonResult(StateCode stateCode){
        this.message = stateCode.getMessage();
        this.state = stateCode.getState();
    }
    public static JsonResult ok(Object data){
        return new JsonResult(StateCode.OPERATION_SUCESS,data);
    }
    public static JsonResult ok(){
//        return new JsonResult(StatusCode.OPERATION_SUCCESS);
        return JsonResult.ok(null);
    }
}
